package com.nlp.visualization.service.weibo.main;

import com.nlp.visualization.common.CONSTANTS;
import com.nlp.visualization.core.seg.SegmentType;
import com.nlp.visualization.core.seg.filter.SegFilter;
import com.nlp.visualization.service.weibo.IWeiboSegService;
import com.nlp.visualization.service.weibo.WeiboSegServiceImpl;


public class Main {


    public static void main(String[] args) {

        Main main = new Main();
//        main.tansform();
        //     main.test();
        // main.json();
        //  main.bigCsv();
        // main.bigCsvNoStop();
        //  main.bigJson();
        // main.bigJson_Nostopword();
        // main.bigbigJsonNoStop();

        //main.testJson2SQL();
        main.union_sw();

    }

    public void tansform() {
        IWeiboSegService weiboSegService = new WeiboSegServiceImpl();
        weiboSegService.csv2Json(CONSTANTS.CSV_PATH, CONSTANTS.JSON_PATH, CONSTANTS.WEIBO_CSV_HEADERS);
    }

    public void test() {

        SegFilter.FilterBuilder builder = new SegFilter.FilterBuilder();
        builder.enablePunctuation(true)
                .enableStopwords(true);

        SegFilter filter = builder.build();
        IWeiboSegService weiboSegService = new WeiboSegServiceImpl();

        weiboSegService.csv2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/testCSV.csv",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/testJSON.json", CONSTANTS.WEIBO_CSV_HEADERS);
        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/testJSON.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/ResultJSON.json", SegmentType.HANLP_NLP, filter);
    }

    public void json() {
        SegFilter.FilterBuilder builder = new SegFilter.FilterBuilder();
        builder.enablePunctuation(true)
                .enableStopwords(true);
        SegFilter filter = builder.build();
        IWeiboSegService weiboSegServic = new WeiboSegServiceImpl();
        weiboSegServic.jsonPreProcess("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/orgJson.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/afterJson.json");
        weiboSegServic.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/afterJson.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/ResultJSON.json", SegmentType.HANLP_NLP, filter);
    }

    /**
     * 正式的csv文件导出数据，开启标点和停止词过滤
     */
    public void bigCsv() {
        SegFilter.FilterBuilder builder = new SegFilter.FilterBuilder();
        builder.enablePunctuation(true)
                .enableStopwords(true);

        SegFilter filter = builder.build();
        IWeiboSegService weiboSegService = new WeiboSegServiceImpl();
        weiboSegService.csv2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessage.csv",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessage.json", CONSTANTS.WEIBO_CSV_HEADERS);
        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessage.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/_20171019_Stopwords.json", SegmentType.HANLP_NLP, filter);
    }

    public void bigCsvNoStop() {
        SegFilter.FilterBuilder builder = new SegFilter.FilterBuilder();
        builder.enablePunctuation(true)
                .enableStopwords(false);
        SegFilter filter = builder.build();
        IWeiboSegService weiboSegService = new WeiboSegServiceImpl();
        weiboSegService.csv2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessage.csv",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessage.json", CONSTANTS.WEIBO_CSV_HEADERS);
        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessage.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/_20171019_No_Stopwords.json", SegmentType.HANLP_NLP, filter);
    }

    public void bigJson() {
        SegFilter.FilterBuilder builder = new SegFilter.FilterBuilder();
        builder.enablePunctuation(true)
                .enableStopwords(false);
        SegFilter filter = builder.build();
        IWeiboSegService weiboSegService = new WeiboSegServiceImpl();
        weiboSegService.jsonPreProcess("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessages.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessagesTEMP.json");
        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessagesTEMP.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/_20180109_Stopwords.json", SegmentType.HANLP_NLP, filter);
    }

    public void bigJson_Nostopword() {
        SegFilter.FilterBuilder builder = new SegFilter.FilterBuilder();
        builder.enablePunctuation(true)
                .enableStopwords(true);
        SegFilter filter = builder.build();
        IWeiboSegService weiboSegService = new WeiboSegServiceImpl();
        weiboSegService.jsonPreProcess("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessages.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessagesTEMP.json");
        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessagesTEMP.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/_20180109_Stopwords.json", SegmentType.HANLP_NLP, filter);
    }

    public void bigbigJsonNoStop() {

        SegFilter.FilterBuilder builder = new SegFilter.FilterBuilder();
        builder.enablePunctuation(true)
                .enableStopwords(false);
        SegFilter filter = builder.build();
        IWeiboSegService weiboSegService = new WeiboSegServiceImpl();
        weiboSegService.jsonPreProcess("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessage.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessagesTEMP.json");
        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/weiboUserMessagesTEMP.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/_20171120_NO_Stopwords.json", SegmentType.HANLP_NLP, filter);

    }

    public void testJson2SQL() {
        SegFilter.FilterBuilder builder = new SegFilter.FilterBuilder();
        builder.enablePunctuation(true)
                .enableStopwords(true);
        SegFilter filter = builder.build();
        IWeiboSegService weiboSegService = new WeiboSegServiceImpl();
        weiboSegService.jsonPreProcess("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/orgJson.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/afterJson.json");
        weiboSegService.seg2SQL("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/afterJson.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/resultSQL.txt", SegmentType.HANLP_NLP, filter);

    }


    public void union_sw() {
        SegFilter.FilterBuilder builder = new SegFilter.FilterBuilder();
        builder.enablePunctuation(true)
                .enableStopwords(false);
        SegFilter filter_nosw = builder.build();

        SegFilter.FilterBuilder builder2 = new SegFilter.FilterBuilder();
        builder2.enablePunctuation(true)
                .enableStopwords(true);
        SegFilter filter_sw = builder2.build();

        IWeiboSegService weiboSegService = new WeiboSegServiceImpl();
//        weiboSegService.csv2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171019.csv",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171019_sw_temp.json", CONSTANTS.WEIBO_CSV_HEADERS);
//        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171019_sw_temp.json",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171019_sw.json", SegmentType.HANLP_NLP, filter);
        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171019_sw_temp.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171019_no_sw.json", SegmentType.HANLP_NLP, filter_nosw);
//        weiboSegService.seg2SQL("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171019_sw_temp.json",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171019_sw.sql", SegmentType.HANLP_NLP, filter_sw);
//        weiboSegService.seg2SQL("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171019_sw_temp.json",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171019_no_sw.sql", SegmentType.HANLP_NLP, filter_nosw);
//
//        weiboSegService.jsonPreProcess("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171120.json",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171120_sw_temp.json");
//        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171120_sw_temp.json",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171120_sw.json", SegmentType.HANLP_NLP, filter);
//        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171120_sw_temp.json",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171120_no_sw.json", SegmentType.HANLP_NLP, filter_nosw);
//        weiboSegService.seg2SQL("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171120_sw_temp.json",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171120_sw.sql", SegmentType.HANLP_NLP, filter_sw);
//        weiboSegService.seg2SQL("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171120_sw_temp.json",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20171120_no_sw.sql", SegmentType.HANLP_NLP, filter_nosw);

//        weiboSegService.jsonPreProcess("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20180109.json",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20180109_sw_temp.json");
//        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20180109_sw_temp.json",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20180109_sw.json", SegmentType.HANLP_NLP, filter);
//        weiboSegService.seg2Json("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20180109_sw_temp.json",
//                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20180109_no_sw.json", SegmentType.HANLP_NLP, filter_nosw);
        weiboSegService.seg2SQL("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20180109_sw_temp.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20180109_sw.sql", SegmentType.HANLP_NLP, filter_sw);
        weiboSegService.seg2SQL("/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20180109_sw_temp.json",
                "/Users/lxm/MyComputer/temp/TeacherWang_weibo_data/needParse/20180109_no_sw.sql", SegmentType.HANLP_NLP, filter_nosw);


    }

}
